package com.edu.d3_collections;

import java.util.ArrayList;
import java.util.Collections;

public class CollectionsDemo1 {
    /**
     * Collections  操作集合的工具类
     */
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        /**
         * 1、Collections直接给集合中批量添加元素
         */
        Collections.addAll(list,"楚留香","令狐冲","西门吹雪");
        System.out.println(list);
        /**
         * 2、public syatic vois shuffle(list<?> list)打乱list集合顺序
         */
        Collections.shuffle(list);
        System.out.println(list);
        /**
         * 3、public ststic <T> void sort(List<T> list)按照默认规则，对集合中的元素进行排序，，排值规则---默认升序规则
         */
        ArrayList<Double> list1 = new ArrayList<>();
        Collections.addAll(list1,11.2,88.3,44.3,66.7,42.2);
        System.out.println(list1);
        Collections.sort(list1);
        System.out.println(list1);
    }
}
